
var Class = {create:function () {
	return function () {
		this.initialize.apply(this, arguments);
	};
}};
var Abstract = new Object();
Object.extend = function (destination, source) {
	for (property in source) {
		destination[property] = source[property];
	}
	return destination;
};
Object.prototype.extend = function (object) {
	return Object.extend.apply(this, [this, object]);
};
Function.prototype.bind = function (object) {
	var __method = this;
	return function () {
		__method.apply(object, arguments);
	};
};
Function.prototype.bindAsEventListener = function (object) {
	var __method = this;
	return function (event) {
		__method.call(object, event || window.event);
	};
};
Number.prototype.toColorPart = function () {
	var digits = this.toString(16);
	if (this < 16) {
		return "0" + digits;
	}
	return digits;
};
var Try = {these:function () {
	var returnValue;
	for (var i = 0; i < arguments.length; i++) {
		var lambda = arguments[i];
		try {
			returnValue = lambda();
			break;
		}
		catch (e) {
		}
	}
	return returnValue;
}};
/*--------------------------------------------------------------------------*/
var PeriodicalExecuter = Class.create();
PeriodicalExecuter.prototype = {initialize:function (callback, frequency) {
	this.callback = callback;
	this.frequency = frequency;
	this.currentlyExecuting = false;
	this.registerCallback();
}, registerCallback:function () {
	setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
}, onTimerEvent:function () {
	if (!this.currentlyExecuting) {
		try {
			this.currentlyExecuting = true;
			this.callback();
		}
		finally {
			this.currentlyExecuting = false;
		}
	}
}};

